package com.goodving.guli.database.p052b;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.text.TextUtils;

import com.goodving.guli.bt.profile.scale.GuliLog;

import java.util.ArrayList;
import java.util.List;

/* renamed from: cn.com.smartdevices.bracelet.d.b.a */
public class C0854a {
    public static List<String> m8952a(SQLiteDatabase sQLiteDatabase) {
        Cursor cursor = null;
        if (sQLiteDatabase == null) {
            throw new IllegalArgumentException();
        }
        try {
            cursor = sQLiteDatabase.rawQuery("SELECT name FROM sqlite_sequence", null);
            List<String> arrayList;
            if (cursor == null || cursor.getCount() == 0) {
                arrayList = new ArrayList(0);
                if (cursor == null) {
                    return arrayList;
                }
                cursor.close();
                return arrayList;
            }
            arrayList = new ArrayList(cursor.getCount());
            while (cursor.moveToNext()) {
                arrayList.add(cursor.getString(0));
            }
            if (cursor == null) {
                return arrayList;
            }
            cursor.close();
            return arrayList;
        } catch (Exception e) {
            GuliLog.tracePrintError("DB", e.getMessage());
            return new ArrayList(0);
        } finally {
            if (cursor != null) {
                cursor.close();
            }
        }
    }

    public static boolean m8953a(SQLiteDatabase sQLiteDatabase, String str) {
        Cursor cursor = null;
        boolean z = false;
        if (sQLiteDatabase == null) {
            throw new IllegalArgumentException();
        }
        if (!TextUtils.isEmpty(str)) {
            try {
                cursor = sQLiteDatabase.rawQuery("SELECT name FROM sqlite_sequence", null);
                if (cursor != null && cursor.getCount() != 0) {
                    do {
                        if (!cursor.moveToNext()) {
                            if (cursor != null) {
                                cursor.close();
                            }
                        }
                    } while (!cursor.getString(0).equals(str));
                    z = true;
                    if (cursor != null) {
                        cursor.close();
                    }
                } else if (cursor != null) {
                    cursor.close();
                }
            } catch (Exception e) {
                GuliLog.tracePrintError("DB", e.getMessage());
                if (cursor != null) {
                    cursor.close();
                }
            } catch (Throwable th) {
                if (cursor != null) {
                    cursor.close();
                }
            }
        }
        return z;
    }
}
